<template>
  <div class="wrap">
    <template v-for="(item,index) in dataFromParent">
      <el-form-item :key="index" :label="item.label" :prop="item.prop" style="margin-right:13px">
        <el-input
          v-if="item.isInput === 1"
          v-model="item.model"
          :size="item.size"
          :type="item.type"
          :placeholder="item.placeholder"
          :prefix-icon="item.icon"
          :clearable="item.isClearable"
        />
        <el-select
          v-if="item.isSelect === 1 && item.isDict === false"
          v-model="item.model"
          :size="item.size"
          :filterable="item.filterable"
          :clearable="item.isclearable"
          :placeholder="item.placeholder"
        >
          <el-option
            v-for="optionItem in item.statusOptions"
            :key="optionItem.value"
            :label="optionItem.label"
            :value="optionItem.value"
          />
        </el-select>
        <el-select
          v-if="item.isSelect === 1 && item.isDict === true"
          v-model="item.model"
          :size="item.size"
          :filterable="item.filterable"
          :clearable="item.isclearable"
          :placeholder="item.placeholder"
        >
          <el-option
            v-for="dict in item.statusOptions"
            :key="dict.dictValue"
            :label="dict.dictLabel"
            :value="dict.dictValue"
          />
        </el-select>
        <el-date-picker
          v-if="item.isDatePicker === 1"
          v-model="item.model"
          style="width:225px"
          :size="item.size"
          :clearable="item.isclearable"
          :start-placeholder="item.start"
          :end-placeholder="item.end"
          :type="item.type"
          value-format="yyyy-MM-dd"
        />
      </el-form-item>
    </template>
  </div>
</template>
<script>
export default {
  name: 'HighLevelSetting',
  // 接收来自父组件传递的参数
  // eslint-disable-next-line vue/require-prop-types
  props: ['parentToChild'],
  data() {
    return {
      dataFromParent: []
    }
  },
  watch: {
    dataFromParent(newval, oldval) {
      this.$emit('sendValueToParent', newval)
    }
  },
  created() {
    this.dataFromParent = this.parentToChild
  },
  methods: {
  }
}
</script>
<style scoped>
  .wrap{
    display: inline-block;
  }
</style>
